/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.wise.common.device.info.domain;

import com.wise.common.device.type.domain.GfDeviceType;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author gaocm
* @date 2020-11-04
**/
@Entity
@Data
@Table(name="gf_device")
public class GfDevice implements Serializable {

    @OneToOne
    @JoinColumn(name = "device_type_id")
    @ApiModelProperty(value = "设备类型")
    private GfDeviceType deviceType;

    @Column(name = "DEVICE_NUMBER")
    @ApiModelProperty(value = "设备编号")
    private String deviceNumber;

    @Column(name = "DEVICE_STATE")
    @ApiModelProperty(value = "设备状态")
    private String deviceState;

    @Column(name = "SECRET_LEVEL")
    @ApiModelProperty(value = "保密等级")
    private String secretLevel;

    @Column(name = "MANAGER")
    @ApiModelProperty(value = "负责人编号")
    private String manager;

    @Column(name = "DEVICE_IP")
    @ApiModelProperty(value = "设备的IP地址")
    private String deviceIp;

    @Column(name = "SFTP_PORT")
    @ApiModelProperty(value = "设备SFTP的端口")
    private BigDecimal sftpPort;

    @Column(name = "SFTP_USERNAME")
    @ApiModelProperty(value = "SFTP用户名")
    private String sftpUsername;

    @Column(name = "SFTP_PASSWORD")
    @ApiModelProperty(value = "SFTP密码")
    private String sftpPassword;

    @Column(name = "SFTP_RSA_PUBKEY")
    @ApiModelProperty(value = "RSA公钥字符串")
    private String sftpRsaPubkey;

    @Column(name = "SFTP_RSA_PRIKEY")
    @ApiModelProperty(value = "RSA私钥字符串")
    private String sftpRsaPrikey;

    @Column(name = "UPDATE_TIME")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @Column(name = "UPDATE_PERSON")
    @ApiModelProperty(value = "更新人")
    private String updatePerson;

    @Column(name = "CREATE_TIME")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "CREATER")
    @ApiModelProperty(value = "创建人")
    private String creater;

    @Column(name = "OPERATION_MODE")
    @ApiModelProperty(value = "操作模式")
    private String operationMode;

    @Column(name = "OCCUPY_TIMES")
    @ApiModelProperty(value = "设备占用时间")
    private Timestamp occupyTimes;

    @Column(name = "DEVICE_PORT")
    @ApiModelProperty(value = "设备的端口")
    private String devicePort;

    @Column(name = "DEVICE_AGREEMENT")
    @ApiModelProperty(value = "设备的连接协议")
    private String deviceAgreement;

    @Column(name = "MANAGER_ID")
    @ApiModelProperty(value = "负责人id")
    private String managerId;

    @Column(name = "DEVICE_NAME")
    @ApiModelProperty(value = "设备名称")
    private String deviceName;

    @Column(name = "WISECODE")
    @ApiModelProperty(value = "wise码")
    private String wisecode;

    @Column(name = "USER_DEPART")
    @ApiModelProperty(value = "使用单位（部门）")
    private String userDepart;

    @Column(name = "REMARKS")
    @ApiModelProperty(value = "备注")
    private String remarks;

    @Column(name = "FUNDING_SOURCE")
    @ApiModelProperty(value = "资金来源")
    private String fundingSource;

    @Column(name = "ENABLATION_TIME")
    @ApiModelProperty(value = "启用时间")
    private Timestamp enablationTime;

    @Column(name = "TYPE_MARK")
    @ApiModelProperty(value = "设备类别")
    private String typeMark;

    @Column(name = "TOOLS_NUM")
    @ApiModelProperty(value = "刀位数量")
    private Integer toolsNum;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "主键")
    private Long id;

    public void copy(GfDevice source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}